﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace UI.Forms
{
    public partial class gd_input : FormBase1
    {
        public gd_input()
        {
            InitializeComponent();
        }

        private void dateEdit1_EditValueChanged(object sender, EventArgs e)
        {
            if (dateEdit1.EditValue == null) return;
            te_pid.Text = my.bw.getBillNO(my.emp_lite.shopcode, dateEdit1.DateTime, 10, my.ACID);
        }

        private void gd_input_Load(object sender, EventArgs e)
        {
            lue_opID.Properties.DataSource = my.bw.View_Emp_lite_List("", my.ACID);
            dateEdit1.EditValue = DateTime.Now;
        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (dvp.Validate())
            {
                SVC.client.gd d = new SVC.client.gd();
                d.action = te_dz.Text.Trim();
                d.clientAdd = te_khdz.Text.Trim();
                d.cpsb1 = te_sb1.Text.Trim();
                d.cpsb2 = te_sb2.Text.Trim();
                d.cptc = te_cp.Text.Trim();
                d.cust1 = te_zdy1.Text.Trim();
                d.cust2 = te_zdy2.Text.Trim();
                d.cust3 = te_zdy3.Text.Trim();
                d.fpno=te_fph.Text.Trim();
                d.khmc = te_khmc.Text.Trim();
                d.khtel = te_khdh.Text.Trim();
                d.opid = new Guid(lue_opID.EditValue.ToString());
                d.PDate = dateEdit1.DateTime;
                d.pid = te_pid.Text;
                d.qszk=te_qszk.Text.Trim();
                d.skfs = te_skfs.Text.Trim();
                d.ssje = Convert.ToDecimal(sp_ssje.EditValue);
                d.xsp = te_xsp.Text.Trim();
                d.yhje = Convert.ToDecimal(sp_yhje.EditValue);
                d.ysje = Convert.ToDecimal(sp_yhje.EditValue);
                d.ywno = te_ywhm.Text.Trim();
                d.zp = te_zp.Text.Trim();
                string r = my.bw.gd_Add(d, my.ACID);
                if (!string.IsNullOrEmpty(r))
                {
                    Comm.ShowErorr(r);
                }
                else
                {
                    Comm.ShowInfo("保存工单成功！");
                }
            }
        }




    }
}